.class public Lcom/hyphenate/chat/EMPreferenceUtils;
.super Ljava/lang/Object;


# static fields
.field private static final PREFERENCE_NAME:Ljava/lang/String; = "hyphenate.sdk.pref"

.field private static SCHEDULED_LOGOUT_TIME:Ljava/lang/String;

.field private static SHARED_KEY_DDTIME:Ljava/lang/String;

.field private static SHARED_KEY_DDVERSION:Ljava/lang/String;

.field private static SHARED_KEY_DDXML:Ljava/lang/String;

.field private static SHARED_KEY_GCM_ID:Ljava/lang/String;

.field private static VALID_BEFORE:Ljava/lang/String;

.field private static mEditor:Landroid/content/SharedPreferences$Editor;

.field private static mPreferenceUtils:Lcom/hyphenate/chat/EMPreferenceUtils;

.field private static mSharedPreferences:Landroid/content/SharedPreferences;


# instance fields
.field private reservedLogoutTime:J


# direct methods
.method static constructor <clinit>()V
    .locals 1

    const-string/jumbo v0, "shared_key_ddversion"

    sput-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->SHARED_KEY_DDVERSION:Ljava/lang/String;

    const-string/jumbo v0, "shared_key_ddxml"

    sput-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->SHARED_KEY_DDXML:Ljava/lang/String;

    const-string/jumbo v0, "shared_key_ddtime"

    sput-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->SHARED_KEY_DDTIME:Ljava/lang/String;

    const-string/jumbo v0, "valid_before"

    sput-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->VALID_BEFORE:Ljava/lang/String;

    const-string/jumbo v0, "scheduled_logout_time"

    sput-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->SCHEDULED_LOGOUT_TIME:Ljava/lang/String;

    const-string/jumbo v0, "shared_key_gcm_id"

    sput-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->SHARED_KEY_GCM_ID:Ljava/lang/String;

    return-void
.end method

.method private constructor <init>(Landroid/content/Context;)V
    .locals 2
    .annotation build Landroid/annotation/SuppressLint;
        value = {
            "CommitPrefEdits"
        }
    .end annotation

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const-wide/16 v0, 0x0

    iput-wide v0, p0, Lcom/hyphenate/chat/EMPreferenceUtils;->reservedLogoutTime:J

    const-string/jumbo v0, "hyphenate.sdk.pref"

    const/4 v1, 0x0

    invoke-virtual {p1, v0, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v0

    sput-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    sput-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    return-void
.end method

.method public static declared-synchronized getInstance()Lcom/hyphenate/chat/EMPreferenceUtils;
    .locals 3

    const-class v1, Lcom/hyphenate/chat/EMPreferenceUtils;

    monitor-enter v1

    :try_start_0
    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mPreferenceUtils:Lcom/hyphenate/chat/EMPreferenceUtils;

    if-nez v0, :cond_0

    new-instance v0, Lcom/hyphenate/chat/EMPreferenceUtils;

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v2

    invoke-virtual {v2}, Lcom/hyphenate/chat/EMClient;->getContext()Landroid/content/Context;

    move-result-object v2

    invoke-direct {v0, v2}, Lcom/hyphenate/chat/EMPreferenceUtils;-><init>(Landroid/content/Context;)V

    sput-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mPreferenceUtils:Lcom/hyphenate/chat/EMPreferenceUtils;

    :cond_0
    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mPreferenceUtils:Lcom/hyphenate/chat/EMPreferenceUtils;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit v1

    return-object v0

    :catchall_0
    move-exception v0

    monitor-exit v1

    throw v0
.end method


# virtual methods
.method public getDNSConfig()Ljava/lang/String;
    .locals 3

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->SHARED_KEY_DDXML:Ljava/lang/String;

    const-string/jumbo v2, ""

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getDNSTime()J
    .locals 4

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->SHARED_KEY_DDTIME:Ljava/lang/String;

    const-wide/16 v2, -0x1

    invoke-interface {v0, v1, v2, v3}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J

    move-result-wide v0

    return-wide v0
.end method

.method public getDNSValidBefore()J
    .locals 4

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->VALID_BEFORE:Ljava/lang/String;

    const-wide/16 v2, -0x1

    invoke-interface {v0, v1, v2, v3}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J

    move-result-wide v0

    return-wide v0
.end method

.method public getDNSVersion()Ljava/lang/String;
    .locals 3

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->SHARED_KEY_DDVERSION:Ljava/lang/String;

    const-string/jumbo v2, ""

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getDebugAppkey()Ljava/lang/String;
    .locals 3

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    const-string/jumbo v1, "debugAppkey"

    const/4 v2, 0x0

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getDebugIMAddress()Ljava/lang/String;
    .locals 3

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    const-string/jumbo v1, "debugIM"

    const/4 v2, 0x0

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getDebugMode()Ljava/lang/String;
    .locals 3

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    const-string/jumbo v1, "debugMode"

    const/4 v2, 0x0

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getDebugRestAddress()Ljava/lang/String;
    .locals 3

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    const-string/jumbo v1, "debugRest"

    const/4 v2, 0x0

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getGCMToken()Ljava/lang/String;
    .locals 3

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->SHARED_KEY_GCM_ID:Ljava/lang/String;

    const/4 v2, 0x0

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getLogoutTime()J
    .locals 4

    iget-wide v0, p0, Lcom/hyphenate/chat/EMPreferenceUtils;->reservedLogoutTime:J

    const-wide/16 v2, 0x0

    cmp-long v0, v0, v2

    if-eqz v0, :cond_0

    iget-wide v0, p0, Lcom/hyphenate/chat/EMPreferenceUtils;->reservedLogoutTime:J

    :goto_0
    return-wide v0

    :cond_0
    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->SCHEDULED_LOGOUT_TIME:Ljava/lang/String;

    const-wide/16 v2, -0x1

    invoke-interface {v0, v1, v2, v3}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J

    move-result-wide v0

    iput-wide v0, p0, Lcom/hyphenate/chat/EMPreferenceUtils;->reservedLogoutTime:J

    iget-wide v0, p0, Lcom/hyphenate/chat/EMPreferenceUtils;->reservedLogoutTime:J

    goto :goto_0
.end method

.method public hasReservedLogoutTime()Z
    .locals 4

    iget-wide v0, p0, Lcom/hyphenate/chat/EMPreferenceUtils;->reservedLogoutTime:J

    const-wide/16 v2, 0x0

    cmp-long v0, v0, v2

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mSharedPreferences:Landroid/content/SharedPreferences;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->SCHEDULED_LOGOUT_TIME:Ljava/lang/String;

    invoke-interface {v0, v1}, Landroid/content/SharedPreferences;->contains(Ljava/lang/String;)Z

    move-result v0

    goto :goto_0
.end method

.method public removeLogoutTime()V
    .locals 2

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMPreferenceUtils;->hasReservedLogoutTime()Z

    move-result v0

    if-eqz v0, :cond_0

    const-wide/16 v0, 0x0

    iput-wide v0, p0, Lcom/hyphenate/chat/EMPreferenceUtils;->reservedLogoutTime:J

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->SCHEDULED_LOGOUT_TIME:Ljava/lang/String;

    invoke-interface {v0, v1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    :cond_0
    return-void
.end method

.method public setDNSConfig(Ljava/lang/String;)V
    .locals 2

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->SHARED_KEY_DDXML:Ljava/lang/String;

    invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    return-void
.end method

.method public setDNSConfigTime(J)V
    .locals 3

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->SHARED_KEY_DDTIME:Ljava/lang/String;

    invoke-interface {v0, v1, p1, p2}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    return-void
.end method

.method public setDNSConfigVersion(Ljava/lang/String;)V
    .locals 2

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->SHARED_KEY_DDVERSION:Ljava/lang/String;

    invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    return-void
.end method

.method public setDNSValidBefore(J)V
    .locals 3

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->VALID_BEFORE:Ljava/lang/String;

    invoke-interface {v0, v1, p1, p2}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    return-void
.end method

.method public setDebugAppkey(Ljava/lang/String;)V
    .locals 2

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    const-string/jumbo v1, "debugAppkey"

    invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    return-void
.end method

.method public setDebugMode(Z)V
    .locals 3

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    const-string/jumbo v1, "debugMode"

    invoke-static {p1}, Ljava/lang/String;->valueOf(Z)Ljava/lang/String;

    move-result-object v2

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    return-void
.end method

.method public setDebugServer(Ljava/lang/String;Ljava/lang/String;)V
    .locals 2

    if-nez p1, :cond_0

    if-nez p2, :cond_0

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    const-string/jumbo v1, "debugIM"

    invoke-interface {v0, v1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    const-string/jumbo v1, "debugRest"

    invoke-interface {v0, v1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    :goto_0
    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    return-void

    :cond_0
    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    const-string/jumbo v1, "debugIM"

    invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    const-string/jumbo v1, "debugRest"

    invoke-interface {v0, v1, p2}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    goto :goto_0
.end method

.method public setGCMToken(Ljava/lang/String;)V
    .locals 2

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->SHARED_KEY_GCM_ID:Ljava/lang/String;

    invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    return-void
.end method

.method public setLogoutTime(J)V
    .locals 3

    iput-wide p1, p0, Lcom/hyphenate/chat/EMPreferenceUtils;->reservedLogoutTime:J

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    sget-object v1, Lcom/hyphenate/chat/EMPreferenceUtils;->SCHEDULED_LOGOUT_TIME:Ljava/lang/String;

    invoke-interface {v0, v1, p1, p2}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;

    sget-object v0, Lcom/hyphenate/chat/EMPreferenceUtils;->mEditor:Landroid/content/SharedPreferences$Editor;

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    return-void
.end method
